package com.cin.cma.common.enums;

import cn.hutool.core.util.StrUtil;
import lombok.Getter;


@Getter
public enum ServiceFeeEnum {
    TICKET("TICKET", ":每张票计费"),
    ORDER("ORDER", ":每单计费"),
    NORMAL("NORMAL", "无服务费"),
    ;

    private final String code;
    private final String desc;

    ServiceFeeEnum(String code, String desc) {
        this.code = code;
        this.desc = desc;
    }

    public static ServiceFeeEnum buildServiceFeeEnum(String code) {
        if (StrUtil.isBlank(code)) {
            return NORMAL;
        }

        switch (code) {
            case "order":
                return TICKET;
            case "ticket":
                return ORDER;
            case "T":
                return TICKET;
            case "X":
                return ORDER;
            default:
                return NORMAL;
        }
    }

}
